
CC         = g++
CFLAGS     = -Wall -Wextra -O3 -funroll-loops -c
LDFLAGS    = -O2 -lm
SOURCES    = Debug.cpp WorldState.cpp AntCommander.cpp Ant.cpp
OBJECTS    = $(addsuffix .o, $(basename ${SOURCES}))
EXECUTABLE = AntCommander

# Uncomment the following to enable debugging:
#CFLAGS += -g -DANTS_DEBUG=1 -DDEBUG=1

all: $(OBJECTS) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
	$(CC) $(LDFLAGS) $(OBJECTS) -o $@
	cp AntCommander ../tools/AntCommander

.cpp.o: *.hpp
	$(CC) $(CFLAGS) $< -o $@

clean:
	-rm -f ${EXECUTABLE} ${OBJECTS} *.d
	-rm -f debug.txt

.PHONY: all clean

run:
	cd ../tools; sh play_one_game.sh; cd ../cpp

